<?php 
namespace app\index\model;
use think\Db;
/**
 * Created by Submint Text.
 * User: hetaoren<452649510@qq.com>
 * Date: 2017/03/10
 * Explain: 系统业务处理
 */
class Index extends Base{
    /**
	 * 清除缓存
	 */
	public function clearCache(){
		$dirpath = HTRRootPath()."/runtime/cache";
		$isEmpty = HTRDelDir($dirpath);
		return $isEmpty;
	}
	/**
	 * 获取基础统计信息
	 */
	public function summary(){
		$data = [];
		$data['tody'][0] = Db::name('users')->whereTime('create_time', 'd')->count();
		$data['mall'][0] = Db::name('users')->count();
		$data['tody'][1] = Db::name('orders')->where('createTime', date('Y-m-d'))->count();
		$data['mall'][1] = Db::name('orders')->count();
		$rs = Db::query('select VERSION() as sqlversion');
		$data['MySQL_Version'] = $rs[0]['sqlversion'];
		return $data;
	}
}